package com.hys.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.File;

@Data
@ApiModel
public class EnterpriseParam {

    @ApiModelProperty("企业名称")
    @NotBlank(message = "企业名称不能为空")
    @Length(max = 30, message = "企业名称最长不能超过30个字符")
    private String name;

    @ApiModelProperty("统一社会信用代码")
    @NotBlank(message = "社会信用代码不能为空")
    @Length(max = 18, message = "统一社会信用代码最长不能超过18个字符")
    private String creditCode;

    @ApiModelProperty("企业类型")
    @NotBlank(message = "企业类型不能为空")
    private String type;

    @ApiModelProperty("企业性质")
    @NotBlank(message = "企业性质不能为空")
    private String nature;

    @ApiModelProperty("图片名称")
    private String imageName;

    @ApiModelProperty("磁盘图片文件名")
    private String diskImageName;

    @ApiModelProperty("图片Url回显")
    private String imageUrl;

    public void buildImageUrl(String imgUpUrlPath) {
        imageUrl = imgUpUrlPath + File.separator + diskImageName;
    }

}
